package dk.ahp.getmeoff;

import java.io.File;
import android.app.Application;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Location;
import android.preference.PreferenceManager;
import android.util.Log;


/**
 * Holds all state of the app.
 */
public class GetMeOffApplication extends Application {
	private static final String TAG = GetMeOffApplication.class.getSimpleName();
	public static GetMeOffApplication getMeOffApplication; 
	public SharedPreferences prefs;
	public DestinationLogic destinationLogic;
	public Location currentLocation = null;
	public Location bestGuessLocation = null;
	public Destination tmpDestination = null;
	public Destination activeDestination = null;
	public float distanceToDest = 0;
	public boolean gpsEnabled = false;
	public Thread updateThread = null;
	
	@Override
	public void onCreate() {
		super.onCreate();
		getMeOffApplication = this;
		prefs = PreferenceManager.getDefaultSharedPreferences(this);
	
		File dir = getFilesDir();
		destinationLogic = new DestinationLogic(dir);
		
		//AlarmManger IntentService // ting som skal undersøges
		
		startService(new Intent(this, PositionService.class));
		
		Log.d(TAG, "onCreate");
	}
}
